﻿<?php 
//Lay thong tin cua mot cau hoi
if ($v_qa_id > 0) {
	$v_qa_agency_id = $arr_single_onegate_qa['1'];
	$v_qa_cate_id = $arr_single_onegate_qa['2'];
	$v_answerer_id = $arr_single_onegate_qa['3'];
	$v_approver_id = $arr_single_onegate_qa['4'];
	$v_qa_title = $arr_single_onegate_qa['5'];
	$v_qa_content = $arr_single_onegate_qa['6']; 
	$v_questioner_address =  $arr_single_onegate_qa['7'];
	$v_questioner_tel = $arr_single_onegate_qa['8'];
	$v_questioner_email = $arr_single_onegate_qa['9'];
	$v_questioner_website =  $arr_single_onegate_qa['10'];
	$v_answer_content = $arr_single_onegate_qa['11'];
	$v_question_date = _yyyymmdd_to_ddmmyyyy($arr_single_onegate_qa['12']);	
	$v_answer_date = _yyyymmdd_to_ddmmyyyy($arr_single_onegate_qa['13']);
	$v_approve_date = _yyyymmdd_to_ddmmyyyy($arr_single_onegate_qa['14']);
	$v_qa_status = $arr_single_onegate_qa['15'];
	$v_cate_name = 	$arr_single_onegate_qa['16'];
	$v_agency_name = $arr_single_onegate_qa['17'];
	$v_questioner_name = $arr_single_onegate_qa['18'];
	$v_answerer_name = 	 $arr_single_onegate_qa['19'];
} 
$v_cate_id = 0;
if(isset($_REQUEST['hdn_cate_id'])){
	$v_cate_id = intval($_REQUEST['hdn_cate_id']);
} 
$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter = _replace_bad_char($_REQUEST['hdn_filter']);
}
$v_agency_id = 0;
if(isset($_REQUEST['hdn_agency_id'])){
	$v_agency_id = intval($_REQUEST['hdn_agency_id']);
}
$v_agency = "";
if(isset($_REQUEST['hdn_agency'])){
	$v_agency = $_REQUEST['hdn_agency'];
}
//Luu ten cua linh vuc
$v_cate = "";
if(isset($_REQUEST['hdn_cate'])){
	$v_cate = $_REQUEST['hdn_cate'];
} 
$v_status = -1;
if(isset($_REQUEST['hdn_status'])){	
	$v_status = $_REQUEST['hdn_status'];
}
$v_cate = "";
if(isset($_REQUEST['hdn_cate'])){
	$v_cate = $_REQUEST['hdn_cate'];
}
$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter = _replace_bad_char($_REQUEST['hdn_filter']);
}
if ($v_qa_status == 1) {
	$v_publish = CONST_QA_APPROVING_BUTTON;
} else {
	$v_publish = CONST_QA_UNAPPROVING_BUTTON;
}
if(isset($_REQUEST['hdn_page'])){
	$v_page=intval($_REQUEST['hdn_page']);
}else{
	$v_page=1;
}
$v_url = "index.php";
?>
<!-- Bat cac phim: F12=true; Insert=false; Delete=false, ESC=true; Enter=true -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="normal_title">
		<td><?php echo CONST_QA_QUESTION_FOR_APPROVE_TITLE; ?></td>
	</tr>
</table>
<!--bang chua cac text box de nhap du lieu-->
<form action="index.php" method="post" name="f_dsp_single_qa_question_for_approve">
<table width="100%" class="form_table1">
	<col width="15%"><col width="35%"><col width="15%"><col width="35%">
		<!--forms chinh-->
		<input type="hidden" name="fuseaction" value="" >
      	<input type="hidden" name="hdn_cate_id" value="<?php echo $v_cate_id; ?>">
		<input type="hidden" name="hdn_filter" value="<?php echo $v_filter; ?>">
		<input type="hidden" name="hdn_qa_id" value="<?php echo $v_qa_id; ?>">
		<input type="hidden" name="hdn_qa_status" value="<?php echo $v_qa_status; ?>">
		<input type="hidden" name="hdn_cate" value="<?php echo $v_cate; ?>">
		<input type="hidden" name="hdn_status" value="<?php echo $v_status; ?>">
		<input type="hidden" name="hdn_top_id" value="<?php echo $v_top_id; ?>">
		<input type="hidden" name="hdn_bottom_id" value="<?php echo $v_bottom_id; ?>">
	    <input type="hidden" name="hdn_agency" value="<?php echo $v_agency;?>">
	    <input type="hidden" name="hdn_agency_id" value="<?php echo $v_agency_id;?>">
  	    <input type="hidden" name="hdn_qa_cate_id" value="<?php echo $v_qa_cate_id;?>">
	    <input type="hidden" name="hdn_qa_agency_id" value="<?php echo $v_qa_agency_id;?>">
		<input type="hidden" name="hdn_direction" value="<?php echo $v_direction; ?>">
		<input type="hidden" name="hdn_exception_qa_id" value="<?php echo $v_exception_qa_id; ?>">
		<input type="hidden" name="hdn_page" value="<?php echo $v_page;?>">
	<tr>
		<td class="small_title" colspan="10">
			<?php echo CONST_CATE_LABEL.'&nbsp;&nbsp;'.$v_cate_name; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title" colspan="10">
			<?php echo CONST_AGENCY_NAME_LABEL.'&nbsp;&nbsp;'.$v_agency_name; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title">
			<?php echo CONST_QA_SENDED_DATE_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_question_date; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title">
			<?php echo CONST_QA_SENDER_NAME_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_questioner_name; ?>
		</td>
		<td class="small_title">
			<?php echo CONST_QA_SENDER_ADDRESS_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_questioner_address; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title">
			<?php echo CONST_QA_SENDER_TEL_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_questioner_tel; ?>
		</td>	
		<td class="small_title">
			<?php echo CONST_QA_SENDER_EMAIL_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_questioner_email; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title" colspan="4">
			<?php echo CONST_QA_QUESTION_CONTENT_LABEL; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title" colspan="4">
			<?php echo $v_qa_title; ?>
		</td>
	</tr>
	<tr>
		<td class="content_label" colspan="4" >
			<?php echo _restore_XML_bad_char($v_qa_content); ?>
		</td>
	</tr>
		<tr>
		<td colspan="4" align="center">
			<table width="98%" cellpadding="0" cellspacing="0">
	  			<!--Vong lap hien thi cac file da dinh kem van ban--><? 
					if(isset($arr_all_question_file)){
						$v_count = sizeof($arr_all_question_file);
					}else{
						$v_count = 0;
					}	
					if ($v_qa_id>0 and $v_count>0) { ?>
						<td colspan="12" class="file_attack_list_label"><? echo CONST_QUESTION_FILE_ATTACH_LABEL;?></td><?php
						// Goi thu tuc xu ly khi xoa cac file da co
					for ($i=0; $i<$v_count; $i++) {
					$v_answer_file_id = $arr_all_question_file[$i]['0'];
					$v_answer_file_name = $arr_all_question_file[$i]['2']; 
					if(_is_sqlserver()){
						$v_file_url = trim(CONST_QA_URL_PATH_FROM_ROOT).$v_answer_file_id.$v_answer_file_name;
						$v_goto_url = "javascript:filename_onclick('T_ONEGATE_QA_FILE', 'PK_QA_FILE', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_answer_file_id) . ",'" . $v_file_url ."');" ;
						$target = "";
						}?> 
					<tr>
						<td width="15%"></td>
						<td class="normal_label"><a href="<? echo $v_goto_url; ?>" class="file_attack_label" <? echo $target;?>><img src="<? echo $_ISA_IMAGE_URL_PATH;?>file_attach.jpg" class="normal_image"><? echo $v_answer_file_name;?></td>
					</tr><?
					} 
				}?>	
			</table>
		</td>
	</tr>

	<tr>
		<td colspan="10" ><hr color="#66CCFF" size="1"></td>
	</tr>
	<tr>
		<td class="small_title">
			<?php echo CONST_QA_ANSWERED_DATE_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_answer_date; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title">
			<?php echo CONST_QA_ANSWER_LABEL; ?>
		</td>
		<td class="normal_label">
			<?php echo $v_answerer_name; ?>
		</td>
	</tr>
	<tr>
		<td class="small_title" colspan="4">
			<?php echo CONST_QA_ANSWER_CONTENT_LABEL; ?>
		</td>
	</tr>
	<tr>		
		<td class="content_label" colspan="4" >
			<?php echo _restore_XML_bad_char($v_answer_content); ?>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td colspan="4" align="center">
			<table width="98%" cellpadding="0" cellspacing="0">
	  			<!--Vong lap hien thi cac file da dinh kem van ban--><? 
					if(isset($arr_all_answer_file)){
						$v_answer_count = sizeof($arr_all_answer_file);
					}else{
						$v_answer_count = 0;
					}	
					if ($v_qa_id>0 and $v_answer_count>0) { ?>
						<td colspan="12" class="file_attack_list_label"><? echo CONST_ANSWER_FILE_ATTACH_LABEL;?></td><?php
						// Goi thu tuc xu ly khi xoa cac file da co
					for ($i=0; $i<$v_answer_count; $i++) {
					$v_answer_file_id = $arr_all_answer_file[$i]['0'];
					$v_answer_file_name = $arr_all_answer_file[$i]['2']; 
					if(_is_sqlserver()){
						$v_file_url = trim(CONST_QA_URL_PATH_FROM_ROOT).$v_answer_file_id.$v_answer_file_name;
						$v_goto_url = "javascript:filename_onclick('T_ONEGATE_QA_FILE', 'PK_QA_FILE', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_answer_file_id) . ",'" . $v_file_url ."');" ;
						$target = "";
						}?> 
					<tr>
						<td width="15%"></td>
						<td class="normal_label"><a href="<? echo $v_goto_url; ?>" class="file_attack_label" <? echo $target;?>><img src="<? echo $_ISA_IMAGE_URL_PATH;?>file_attach.jpg" class="normal_image"><? echo $v_answer_file_name;?></td>
					</tr><?
					} 
				}?>	
			</table>
		</td>
	</tr>
</table>
<!--bang chua cac button-->
<table width="100%">
	<tr>
		<td align="center" width="100%" height="40" valign="bottom"><?php
		$v_granted_approver =  intval($arr_check_permission_approver['0']);
			if ($v_is_granted_qa_question_approve And $v_granted_approver) { ?>
				<input type="button" name="btn_save"  class="large_button" value="<?php echo $v_publish;?>" onClick="btn_save_onclick('APPROVE_QA_QUESTION');" onKeyDown="change_focus(document.forms(0),this)"><?php
			} ?>
			<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>');" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
</table>					
</form>
</div>
